import socket
import sys

# Print the python/host information as soon as possible
print "Python:", sys.version
print "Host:", socket.gethostname()

import datetime
import os
import subprocess
import time

for i in range(1,int(sys.argv[2])+1,1):
    iteration = str(i)
    script_vars=[
        'python',
        os.path.join(os.getcwd(), "backrub_seqtol.py"),
        sys.argv[1],
        iteration]

    outfile = open(iteration + "_script.out", "w", 0)
    process = subprocess.Popen(script_vars, stdout=outfile, stderr=subprocess.STDOUT, close_fds=True)
    returncode = process.wait()
    outfile.close()
